package com.atguigu.crowd.mapper;

import com.atguigu.crowd.entity.Auth;
import com.atguigu.crowd.entity.AuthExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestParam;

public interface AuthMapper {
    int countByExample(AuthExample example);

    int deleteByExample(AuthExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Auth record);

    int insertSelective(Auth record);

    List<Auth> selectByExample(AuthExample example);

    Auth selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Auth record, @Param("example") AuthExample example);

    int updateByExample(@Param("record") Auth record, @Param("example") AuthExample example);

    int updateByPrimaryKeySelective(Auth record);

    int updateByPrimaryKey(Auth record);

	List<Auth> selectAllBySql();

	/**
	 * [Mapper层]根据角色id 查询出该角色id所拥有的权限id
	 * @param roleId
	 * @return
	 */
	List<Integer> selectAssignedAuthIdByRole(@Param("roleId") Integer roleId);

	//根据角色id，删除旧的关联关系
	void deleteOldRelationship(Integer roleId);

	/**
	 * 根据 roleId和authIdList 插入新的关系
	 * @param roleId
	 * @param authIdList
	 */
	void insertNewRelationship(@Param("roleId") Integer roleId, @Param("authIdList") List<Integer> authIdList);

	/**
	 * 根据管理员用户的id 查询出他所拥有的所有（已经分配好的角色的）权限
	 * @param adminId
	 * @return
	 */
	List<String> selectAssignedAuthByAdminId(Integer adminId);

}
























